<?php
/* 
* [***********************]
* @author: mazhenyu[houdunwangmzy@163.com]
* @Date:   2014-06-23 15:58:27
* @Last Modified time: 2014-06-27 14:52:54
*/
class DetailsControl extends CommonControl{
    public function index(){
    	$aid = Q('get.aid', 0, 'intval');
    	//获得文章关联数据
    	$data = K('ArticleCateView')->get_one($aid);
    	$data['time'] = date('Y-m-d',$data['sendtime']);
    	$data['curl'] = U('List/index',array('cid'=>$data['category_cid']));
    	$data['total'] = K('Comment')->get_total($aid);
        //发布时间《算出隔现在有多少个小时》
        //小时
        $data['hour']=(time()-$data['total'])/1000000/3600;
        //天
        $data['publish']=(time()-$data['total'])/1000000;
        if($data['publish']){

        }

    	//中文分词处理
        $keywords = String::splitWord($data['title']);
        if(is_array($keywords)){
            $keywords = array_keys($keywords);
        }
        $str="";
        //组出字符串
       foreach ($keywords as $key => $value) {

           $str .= $value." ";
       }

        $seo = array(
            'title'=>$data['title'],
            'keywords'=>$str,
            'des'=>$data['description'],


            );
        $this->assign('article',$data);
        $this->assign('seo',$seo);
    	$this->dis('details.html');
    }


    public function get_click(){
        $aid = Q('get.aid', 0, 'intval');
        $model =  K('Article');
        $model->inc('click','aid=' . $aid,1);
        $click = $model->get_one_data(array('aid'=>$aid),'click');
        echo "document.write({$click['click']})";die;
    }   
}
?>
